package org.example;

public class FinalOperation4ExceptionDemo {

    public static void test(int curTimes)
    {
        try
        {
            if(curTimes > 2)
            {
                System.out.println("finished recursion");
                return;
            }
            System.out.println("test function" +curTimes);
            throw new RuntimeException();
        }
        catch(RuntimeException e)
        {
            System.out.println("catch");
            test(curTimes+1);
        }
        finally {
            System.out.println("finally" + curTimes);
        }
    }
    public static void main(String[] args){
        int times = 0;
        test(times);

    }
}
